package com.zimmor.utils;

import java.io.*;

/**
 * 还原文件程序
 */
public class DecryptFile {
    public static void main(String[] args) throws Exception{
        FileInputStream fileInputStream = new FileInputStream("E:/a1.dat");
        FileOutputStream fileOutputStream = new FileOutputStream("E:/b.jpg");
        int buff = -1;
        int temp = -1;
        boolean flag = true;
        while((buff = fileInputStream.read()) != -1){
            if(flag){
                temp = buff;
                flag = false;
            } else {
                fileOutputStream.write(buff);
                fileOutputStream.write(temp);
                flag = true;
            }

        }
        fileInputStream.close();
        fileOutputStream.close();
    }
}
